package finalED.view;

import java.util.Observable;
import java.util.Observer;

/**
 * QueryWindow.java
 *  
 * 
 * @author Oswaldo Ceballos Zavala
 */
public class QueryWindow extends javax.swing.JDialog implements Observer{

    /** Creates new form QueryWindow */
    public QueryWindow(java.awt.Frame parent, boolean modal, int estado) {
        super(parent, modal);
        initComponents();
        setLocationRelativeTo( parent );
        setTitle( "Resultados " + estado + " ENLACE 2010");
        lbTitulo.setText( lbTitulo.getText() + estado );
        setVisible(true);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        btngCriterios = new javax.swing.ButtonGroup();
        lbTitulo = new javax.swing.JLabel();
        lbValor = new javax.swing.JLabel();
        txtValor = new javax.swing.JTextField();
        btnBuscar = new javax.swing.JButton();
        lbCriterios = new javax.swing.JLabel();
        rbtnMenor = new javax.swing.JRadioButton();
        rbtnMenorIgual = new javax.swing.JRadioButton();
        rbtnMayorIgual = new javax.swing.JRadioButton();
        rbtnMayor = new javax.swing.JRadioButton();
        rbtnIgual = new javax.swing.JRadioButton();
        lbMunicipio = new javax.swing.JLabel();
        cboxMunicipio = new javax.swing.JComboBox();
        lbResOrd = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        tblOrd = new javax.swing.JTable();
        jScrollPane2 = new javax.swing.JScrollPane();
        tblBus = new javax.swing.JTable();
        lbResBus = new javax.swing.JLabel();
        btnPPrincipal = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        lbTitulo.setFont(new java.awt.Font("Comic Sans MS", 0, 18)); // NOI18N
        lbTitulo.setText("Estado: ");

        lbValor.setText("Valor:");

        btnBuscar.setText("Buscar");

        lbCriterios.setText("Criterios:");

        btngCriterios.add(rbtnMenor);
        rbtnMenor.setSelected(true);
        rbtnMenor.setText("<");

        btngCriterios.add(rbtnMenorIgual);
        rbtnMenorIgual.setText("<=");

        btngCriterios.add(rbtnMayorIgual);
        rbtnMayorIgual.setText(">=");

        btngCriterios.add(rbtnMayor);
        rbtnMayor.setText(">");

        btngCriterios.add(rbtnIgual);
        rbtnIgual.setText("=");

        lbMunicipio.setText("Municipio:");

        cboxMunicipio.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        lbResOrd.setText("Listado Ordenado:");

        tblOrd.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Entidad", "Clave Escuela", "Nombre", "Promedio"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false, false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tblOrd.getTableHeader().setReorderingAllowed(false);
        jScrollPane1.setViewportView(tblOrd);

        tblBus.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Entidad", "Clave Escuela", "Nombre", "Promedio"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false, false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tblBus.getTableHeader().setReorderingAllowed(false);
        jScrollPane2.setViewportView(tblBus);

        lbResBus.setText("Resultados Búsqueda:");

        btnPPrincipal.setText("Pantalla Principal");
        btnPPrincipal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPPrincipalActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(42, 42, 42)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(lbResBus)
                        .addGap(651, 651, 651))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(lbValor)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(txtValor, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnBuscar))
                    .addComponent(lbCriterios)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(rbtnMenor)
                                .addGap(18, 18, 18)
                                .addComponent(rbtnMenorIgual))
                            .addComponent(lbMunicipio)
                            .addComponent(lbResOrd))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(rbtnIgual)
                                .addGap(18, 18, 18)
                                .addComponent(rbtnMayorIgual)
                                .addGap(18, 18, 18)
                                .addComponent(rbtnMayor))
                            .addComponent(cboxMunicipio, javax.swing.GroupLayout.PREFERRED_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 772, Short.MAX_VALUE)))
                .addContainerGap())
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(379, Short.MAX_VALUE)
                .addComponent(btnPPrincipal)
                .addGap(357, 357, 357))
            .addGroup(layout.createSequentialGroup()
                .addGap(368, 368, 368)
                .addComponent(lbTitulo)
                .addContainerGap(414, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(22, 22, 22)
                .addComponent(lbTitulo)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 35, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lbValor)
                    .addComponent(txtValor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnBuscar))
                .addGap(18, 18, 18)
                .addComponent(lbCriterios)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(rbtnMenor)
                    .addComponent(rbtnMenorIgual)
                    .addComponent(rbtnMayorIgual)
                    .addComponent(rbtnMayor)
                    .addComponent(rbtnIgual))
                .addGap(32, 32, 32)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lbMunicipio)
                    .addComponent(cboxMunicipio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(lbResOrd)
                .addGap(18, 18, 18)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(lbResBus)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 149, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(30, 30, 30)
                .addComponent(btnPPrincipal)
                .addGap(22, 22, 22))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    //para OBSERVER
    @Override
    public void update(Observable o, Object arg) {
        throw new UnsupportedOperationException("Not supported yet.");
    }
    
    private void btnPPrincipalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPPrincipalActionPerformed
        dispose();
    }//GEN-LAST:event_btnPPrincipalActionPerformed

    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnBuscar;
    private javax.swing.JButton btnPPrincipal;
    private javax.swing.ButtonGroup btngCriterios;
    private javax.swing.JComboBox cboxMunicipio;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JLabel lbCriterios;
    private javax.swing.JLabel lbMunicipio;
    private javax.swing.JLabel lbResBus;
    private javax.swing.JLabel lbResOrd;
    private javax.swing.JLabel lbTitulo;
    private javax.swing.JLabel lbValor;
    private javax.swing.JRadioButton rbtnIgual;
    private javax.swing.JRadioButton rbtnMayor;
    private javax.swing.JRadioButton rbtnMayorIgual;
    private javax.swing.JRadioButton rbtnMenor;
    private javax.swing.JRadioButton rbtnMenorIgual;
    private javax.swing.JTable tblBus;
    private javax.swing.JTable tblOrd;
    private javax.swing.JTextField txtValor;
    // End of variables declaration//GEN-END:variables
 
} //fin clase QueryWindow
